<hr>
<?php
include '../../include/config.php';
/*
 * profile main content.
 * cookie will store user id. ie. id of child account.
 */
//echo '1';
if(isset($_COOKIE['bid'])){
//    echo 'yes';
//    header('Location:view/child');
}
else {
    echo 'no';
        header('Location:http://'.$_SERVER['HTTP_HOST'].'/salusbaby/');

}
if($actor=='')
    $actor=$_GET['actor'];
include '../../include/config.php';
$q = mysql_query("select * from baby_child_profile_detail where bid = " . $_COOKIE['bid'] . "") or die(mysql_error());
while ($row = mysql_fetch_array($q)) {
    $fid = $row['father_id'];
    $mid = $row['mother_id'];
    $buyerr = $row['buyer_id'];
    break;
}
if ($actor == 'FATHER') {
    $result = mysql_query("select * from salus_user_profile_detail where FK_fa_user_id = $fid ") or die(mysql_error());
    if(mysql_num_rows($result)==0)
    {
        //echo '<a href="conf?actor=father">need to configure.</a>';
        include 'conf.php';
    }
} elseif ($actor == 'MOTHER') {
    $result = mysql_query("select * from salus_user_profile_detail where FK_fa_user_id = $mid") or die(mysql_error());
     if(mysql_num_rows($result)==0)
    {
         include 'conf.php';
    }
} elseif ($actor == 'CHILD') {
    $result = mysql_query("select * from baby_child_profile_detail where bid = " . $_COOKIE['bid'] . "") or die(mysql_error());
}
while ($row1 = mysql_fetch_array($result)) {
    ?>

    <div class="color_blue padding_title">BASIC DATA INFO OF <?php echo $actor; ?></div>
    <div class="padding_5"> <div class="float_left edit_profile">Name</div><div class="display_data_strong"><?php echo $row1['name'] ?>&nbsp;</div><div class="clear"></div></div>
    <div class="padding_5"> <div class="float_left edit_profile">Sur name</div><div  class="display_data_strong"><?php echo $row1['sur_name'] ?>&nbsp;</div><div class="clear"></div></div>
    <div class="padding_5"> <div class="float_left edit_profile">Sex</div><div style="color:#454545;font-size: 12px;font-weight: bold"><?php echo $row1['sex'] ?>&nbsp;</div><div class="clear"></div></div>
    <div class="padding_5"> <div class="float_left edit_profile">Date of birth(yyyy-mm-dd)</div><div  class="display_data_strong"><?php echo $row1['date_of_birth'] ?>&nbsp;</div><div class="clear"></div></div>
    <div class="padding_5"> <div class="float_left edit_profile">Address</div><div class="display_data_strong"><?php echo $row1['address'] ?>&nbsp;</div></div>
    <div class="padding_5"> <div class="float_left edit_profile">Zip Code</div><div  class="display_data_strong"><?php echo $row1['zip_code'] ?>&nbsp;</div></div>
    <div class="padding_5"> <div class="float_left edit_profile">City</div><div  class="display_data_strong"><?php echo $row1['city'] ?>&nbsp;</div></div>
    <div class="padding_5"> <div class="float_left edit_profile">District</div><div  class="display_data_strong"><?php echo $row1['district'] ?>&nbsp;</div></div>
    <div class="padding_5"> <div class="float_left edit_profile">Nation</div>
        <div  class="display_data_strong">
            <?php
            if($row1['country']!=''){
            $cnt1 = mysql_fetch_array(mysql_query("select name from fa_country where id='".$row1['country']."'")) or die(mysql_error());
            echo $cnt1[0];
            }
            ?>&nbsp;
        </div>
    </div>
    <div class="padding_5"> <div class="float_left edit_profile">Home phone nr.</div><div  class="display_data_strong"><?php echo $row1['phone'] ?>&nbsp;</div></div>
    <div class="padding_5"> <div class="float_left edit_profile">Mobile phone nr.</div><div  class="display_data_strong"><?php echo $row1['mobile'] ?>&nbsp;</div></div>
    <div class="padding_5"> <div class="float_left edit_profile">Personal Identification Code</div><div  class="display_data_strong"><?php echo $row1['personal_identification_code'] ?>&nbsp;</div></div>
    <div class="padding_5"> <div class="float_left edit_profile">National Health Service Pers. Code</div><div  class="display_data_strong"><?php echo $row1['national_health_service_pers_code'] ?>&nbsp;</div></div>
    <div class="padding_5"> <div class="float_left edit_profile">PIN code</div><div class="display_data_strong" ><?php echo $row1['PIN_code'] ?>&nbsp;</div></div>
    <div class="padding_5"> <div class="float_left edit_profile">E-mail *</div><div  class="display_data_strong"><?php echo $row1['email'] ?>&nbsp;</div></div>


    <?php
    if ($actor == 'MOTHER') {
        $a = mysql_query("select * from baby_mother_gynac where sr = '" . $_COOKIE['bid'] . "'") or die(mysql_error());
        while ($r1 = mysql_fetch_array($a)) {
            ?>
            <div class="color_blue padding_title">PERSONAL GYNECOLOGIST'S INFO</div>
            <div class="padding_5"> <div class="float_left edit_profile">Dr. Name</div><div class="display_data_strong"><?php echo $r1['g_doctor'] ?>&nbsp;</div><div class="clear"></div></div>
            <div class="padding_5"> <div class="float_left edit_profile">Address</div><div class="display_data_strong"><?php echo $r1['g_address'] ?>&nbsp;</div><div class="clear"></div></div>
            <div class="padding_5"> <div class="float_left edit_profile">Telephone</div><div class="display_data_strong"><?php echo $r1['g_tel'] ?>&nbsp;</div><div class="clear"></div></div>
            <div class="padding_5"> <div class="float_left edit_profile">Mobile</div><div class="display_data_strong"><?php echo $r1['g_mob'] ?>&nbsp;</div><div class="clear"></div></div>

            <?php
        }
    }
    ?>
    <?php ?>
    <!--<div class="color_blue padding_title">ACCESS INFO</div>
    <div class="padding_5"> <div class="float_left edit_profile">User Id</div><div  class="display_data"><b></b></div></div>

    <div class="padding_5"> <div class="float_left edit_profile">Password</div><div  class="display_data">savan&nbsp;</div></div>
    <div class="padding_5"> <div class="float_left edit_profile">Password For Edit</div><div  class="display_data">&nbsp;</div></div>-->


    <div class="color_blue padding_title">MORE INFO</div>
    <div class="padding_5"> <div class="float_left edit_profile">Body height in cm.</div><div  class="display_data"><?php echo $row1['height'] ?>&nbsp;</div></div>
    <div class="padding_5"> <div class="float_left edit_profile">Body weight in KG / LBS</div><div  class="display_data"><?php echo $row1['weight'] ?> <?=$row1['wtype']?>&nbsp;</div></div>
    <div class="padding_5"> <div class="float_left edit_profile">Group</div>
        <div  class="display_data">
                <?php 
                if($row1['group']){
                $bg1 = mysql_query("select Name from fa_blood_groups where id = '".$row1['group']."' ") or die(mysql_error());
                $bg = mysql_fetch_array($bg1);
                echo $bg[0]; 
                }
                ?>&nbsp;
            </div>
    </div>
    <div class="padding_5"> <div class="float_left edit_profile">Religion</div>
        <div  class="display_data">
            <?php 
            if($row1['religion']){
            $rl1 = mysql_fetch_array(mysql_query("select name from fa_religion where id='".$row1['religion']."' ")) or die(mysql_error());
            echo $rl1[0];
            }
            ?>&nbsp;
        </div>
    </div>
    <div class="padding_5"> <div class="float_left edit_profile">Private Helath Insurance Company</div><div  class="display_data"><?php echo $row1['private_helath_insurance_company'] ?>&nbsp;</div></div>
    <div class="padding_5"> <div class="float_left edit_profile">Nr. Insurance Agreement</div><div  class="display_data"><?php echo $row1['insurance'] ?>&nbsp;</div></div>
    <div class="padding_5"> <div class="float_left edit_profile">Insurance phone nr.</div><div  class="display_data"><?php echo $row1['phone_insurance'] ?>&nbsp;</div></div>
    <div class="padding_5"> <div class="float_left edit_profile">Name Personal attending Doctor</div><div  class="display_data"><?php echo $row1['name_personal_attending_doctor'] ?>&nbsp;</div></div>
    <div class="padding_5"> <div class="float_left edit_profile">Private practice phone nr.</div><div  class="display_data"><?php echo $row1['private_practice_phone_nr']; ?>&nbsp;</div></div>
    <div class="padding_5"> <div class="float_left edit_profile">Mobile phone nr.</div><div  class="display_data"><?php echo $row1['private_practice_phone_nr'] ?>&nbsp;</div></div>


    <?php if ($actor != 'CHILD') { ?>
        <div class="padding_5"> <div class="float_left edit_profile">Marital status </div><div  class="display_data"><?php echo $row1['marital_status'] ?>&nbsp;</div></div>
        <div class="padding_5"> <div class="float_left edit_profile">Nr. Children </div><div  class="display_data"><?php echo $row1['nr_children'] ?>&nbsp;</div></div>
        <div class="color_blue padding_title">HABIT INFO</div>
        <div class="padding_5"> <div class="float_left edit_profile">Do you accept blood transfusions?</div><div  class="display_data"><?php echo $row1['blood_transfusions'] ?>&nbsp;</div>
            <div class="padding_5"> <div class="float_left edit_profile">Do you accept to be reanimated?</div><div  class="display_data"><?php echo $row1['reanimated'] ?>&nbsp;</div></div>
            <div class="padding_5"> <div class="float_left edit_profile">In case of decease you want to be organ donor?</div><div  class="display_data"><?php echo $row1['organ_donor'] ?>&nbsp;</div></div>
            <div class="padding_5"> <div class="float_left edit_profile">Are you blood donor?</div><div  class="display_data"><?php echo $row1['blood_donor'] ?>&nbsp;</div></div>
            <div class="padding_5"> <div class="float_left edit_profile">Smoke</div><div class="float_left display_data"><?php echo $row1['smoke'] ?>&nbsp;</div>
                <div class="clear"></div>
            </div>
            <div class="padding_5"> <div class="float_left edit_profile">Are you heavy drinker?</div><div  class="display_data"><?php echo $row1['heavy_drinker'] ?>&nbsp;</div></div>
            <div class="padding_5"> <div class="float_left edit_profile">Are you on drugs?</div><div  class="display_data"><?php echo $row1['on_drugs'] ?>&nbsp;</div></div>
            <div class="padding_5"> <div class="float_left edit_profile">Are you on a diet?</div><div  class="display_data"><?php echo $row1['hypocaloric'] ?>&nbsp;</div>
            </div>
            <div class="padding_5"> <div class="float_left edit_profile">Alcohol</div><div  class="display_data"><?php echo $row1['alcohol'] ?>&nbsp;</div></div>
            <!--END INCLUDED CONTENT--></div>
        
        <?php
        if($buyerr==$fid or $buyerr==$mid){ ?>
            <div class="color_blue padding_title">RELATIVES INFO</div>
        <div class="padding_5">
            <div class="float_left edit_profile"> Name of Relative 1 :</div><div  class="display_data"><?php echo $row1['RFN1'] ?>&nbsp;</div>
            <div class="padding_5"> <div class="float_left edit_profile">Detail of Relative 1 :</div><div  class="display_data"><?php echo $row1['RD1'] ?>&nbsp;</div></div>
            <div class="padding_5"> <div class="float_left edit_profile">Phone of Relative 1 :</div><div  class="display_data"><?php echo $row1['RP1'] ?>&nbsp;</div></div>
            <div class="padding_5"> <div class="float_left edit_profile">Mobile Number of Relative 1 :</div><div  class="display_data"><?php echo $row1['RM1'] ?>&nbsp;</div></div><br>
            <div class="float_left edit_profile">Name of Relative 2 :</div><div  class="display_data"><?php echo $row1['RFN2'] ?>&nbsp;</div>
            <div class="padding_5"> <div class="float_left edit_profile">Detail of Relative 2 :</div><div  class="display_data"><?php echo $row1['RD2'] ?>&nbsp;</div></div>
            <div class="padding_5"> <div class="float_left edit_profile">Phone of Relative 2 :</div><div  class="display_data"><?php echo $row1['RP2'] ?>&nbsp;</div></div>
            <div class="padding_5"> <div class="float_left edit_profile">Mobile Number of Relative 2 :</div><div  class="display_data"><?php echo $row1['RM2'] ?>&nbsp;</div></div><br>
            <div class="float_left edit_profile">Name of Relative 3 :</div><div  class="display_data"><?php echo $row1['RFN3'] ?>&nbsp;</div>
            <div class="padding_5"> <div class="float_left edit_profile">Detail of Relative 3 :</div><div  class="display_data"><?php echo $row1['RD3'] ?>&nbsp;</div></div>
            <div class="padding_5"> <div class="float_left edit_profile">Phone of Relative 3 :</div><div  class="display_data"><?php echo $row1['RP3'] ?>&nbsp;</div></div>
            <div class="padding_5"> <div class="float_left edit_profile">Mobile Number of Relative 3 :</div><div  class="display_data"><?php echo $row1['RM3'] ?>&nbsp;</div></div>

        </div>
      <?php  }
        ?>
        
        
        
        
        
        
        <?php
    }
}
?>